{template 'web/_header'} 
{template 'tabs'} 
{if $operation == 'post'}
<div class="main">
	<form {ife 'exhelper.senduser' $item}action="" method="post" {/if} class="form-horizontal form" enctype="multipart/form-data">
		<div class="panel panel-default">
			<div class="panel-heading">快递单发件人信息</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 发件人</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<input type="text" name="sendername" class="form-control" value="{$item['sendername']}" />
							<span class="help-block">如小张，xx商城</span> {else}
							<div class='form-control-static'>{$item['sendername']}</div>
						{/if}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 联系电话</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<input type="text" name="sendertel" class="form-control" value="{$item['sendertel']}" /> 
						{else}
							<div class='form-control-static'>{$item['sendertel']}</div>
						{/if}
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"> 发件地邮编</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<input type="text" name="sendercode" class="form-control" value="{$item['sendercode']}" /> 
						{else}
							<div class='form-control-static'>{$item['sendercode']}</div>
						{/if}
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 发件地址</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<input type="text" name="senderaddress" class="form-control" value="{$item['senderaddress']}" /> 
						{else}
							<div class='form-control-static'>{$item['senderaddress']}</div>
						{/if}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"> 发件城市</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<input type="text" name="sendercity" class="form-control" value="{$item['sendercity']}" /> 
						{else}
							<div class='form-control-static'>{$item['sendercity']}</div>
						{/if}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">发件人签名</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<input type="text" name="sendersign" class="form-control" value="{$item['sendersign']}" />
							<span class="help-block">如小张，小王</span> 
						{else}
							<div class='form-control-static'>{$item['sendersign']}</div>
						{/if}
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否为默认模板</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'exhelper.senduser' $item}
							<label class="radio-inline">
								<input type="radio" name='isdefault' value="1" {if $item[ 'isdefault']==1}checked{/if} /> 是
							</label>
							<label class="radio-inline">
								<input type="radio" name='isdefault' value="0" {if $item[ 'isdefault']==0}checked{/if} /> 否
							</label>
						{else}
							<div class='form-control-static'>{if $item['isdefault']==1}是{else}否{/if}</div>
						{/if}

					</div>
				</div>
				<div class='panel-body'>
					<div class="form-group"></div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							{ife 'exhelper.senduser' $item}
								<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" onclick="return formcheck()" />
								<input type="hidden" name="token" value="{$_W['token']}" /> 
							{/if}
							<input type="button" name="back" onclick='history.back()'  {ifp 'exhelper.senduser.add|exhelper.senduser.edit'}style='margin-left:10px;' {/if} value="返回列表" class="btn btn-default col-lg-1" />
						</div>
					</div>

				</div>
			</div>

	</form>
	</div>
	<script language='javascript'>
		require(['util'], function (u) {
		        $('#cp').each(function () {
		            u.clip(this, $(this).text());
		        });
		    })
		    $('form').submit(function () {
		       if($(':input[name=sendername]').isEmpty()){
		           Tip.focus($(':input[name=sendername]'),'请填写发件人!');
		           return false;
		       }
		        if($(':input[name=sendertel]').isEmpty()){
		           Tip.focus($(':input[name=sendertel]'),'请填写联系电话!');
		           return false;
		       }
		        if($(':input[name=senderaddress]').isEmpty()){
		           Tip.focus($(':input[name=senderaddress]'),'请填写发件地址!');
		           return false;
		       }
		        return true;
		    });
	</script>
	{elseif $operation == 'display'}
	<form action="" method="post">
		<div class="panel panel-default">
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
						<tr>
							<th style="width:30px;">ID</th>
							<th>发件人</th>
							<th>发件人电话</th>
							<th>发件人签名</th>
							<th>发件地邮编</th>
							<th>发件地址</th>
							<th>发件城市</th>
							<th>是否默认</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						{loop $list $row}
						<tr>
							<td>{$row['id']}</td>
							<td>{$row['sendername']}</td>
							<td>{$row['sendertel']}</td>
							<td>{$row['sendersign']}</td>
							<td>{$row['sendercode']}</td>
							<td>{$row['senderaddress']}</td>
							<td>{$row['sendercity']}</td>
							<td>
								{if $row['isdefault']==1}
								<span class='label label-success'><i class='fa fa-check'></i></span> {/if}
							</td>
							<td style="text-align:left;">

								{ifp 'exhelper.senduser.view|exhelper.senduser.edit'}
									<a href="{php echo $this->createPluginWebUrl('exhelper/senduser', array('op' => 'post', 'id' => $row['id']))}" class="btn btn-default btn-sm" title="{ifp 'exhelper.temps.edit'}修改{else}查看{/if}"><i class="fa fa-edit"></i></a>
								{/if} 
								{ifp 'exhelper.senduser.delete'}
									<a href="{php echo $this->createPluginWebUrl('exhelper/senduser', array('op' => 'delete', 'id' => $row['id']))}" class="btn btn-default btn-sm" onclick="return confirm('确认删除此模板?')"title="删除"><i class="fa fa-times"></i></a>
								{/if} 
								{ifp 'exhelper.senduser.setdefault'} 
									{if empty($row['isdefault'])}
										<a href="{php echo $this->createPluginWebUrl('exhelper/temps', array('op' => 'setdefault', 'id' => $row['id']))}" class="btn btn-default btn-sm" onclick="return confirm('确认设置默认?')" title="设置默认"><i class="fa fa-check"></i></a> 
									{/if} 
								{/if}
							</td>
						</tr>
						{/loop}
						<tr>
							<td colspan='8'>
								{ifp 'exhelper.senduser.add'}
									<a class='btn btn-default' href="{php echo $this->createPluginWebUrl('exhelper/senduser',array('op'=>'post'))}"><i class='fa fa-plus'></i> 添加快递单信息模板</a>
									<input type="hidden" name="token" value="{$_W['token']}" /> 
								{/if}
							</td>
						</tr>
					</tbody>
				</table>
				{$pager}
			</div>
		</div>
	</form>
	<script>
		require(['bootstrap'], function ($) {
		        $('.btn').hover(function () {
		            $(this).tooltip('show');
		        }, function () {
		            $(this).tooltip('hide');
		        });
		    });
	</script>

	{/if} 
	{template 'common/footer'}